<?php 
	function __autoload($class){
		require_once "../".$class.".php";
	}
	require_once 'adminHeader.php';
?>
	<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post' onsubmit='confirmDeleteManager()'/>
	<table>
		<th>Choose manager to delete</th>
		<tr>
			<td><select name='allmanagers' id='allmanagers'>
			<?php 
			$dbconnect = new DBconnect();
			$dbconnect->displayAllManagers();
			?>
			</select></td></tr>
		<tr><td><input type='submit' name='delete' value='Delete Manager' /></td></tr>		
	</table>
	</form>
	<script type="text/javascript">
		function confirmDeleteManager(){
			if(!confirm("Are you sure want to delete " + document.getElementById("allmanagers").value+"?")){
				document.getElementById("allmanagers").value = null;
			}		
		}	
	</script>
	<?php 
		if(isset($_POST['delete'])){
			if($_POST['allmanagers'] != null){
				$dbconnect->deleteTeam($_POST['allmanagers']);
				$dbconnect->deleteManager($_POST['allmanagers']);
			}
		}
		require_once 'adminFooter.php';
	?>
